package com.apposcopy.ella.runtime;

import android.content.Intent;
import android.util.Log;

public class AsyncTaskRecorder extends Recorder {
	
	private static final String TAG = AsyncTaskRecorder.class.getSimpleName();
	
	@Override
	public void startAsyncTask(String className) {
		Intent sendIntent = new Intent();
		sendIntent.setAction("edu.iscas.appcheckclient.broadcastreceiver.SEND_ASYNC_TASK_START");
		sendIntent.putExtra("ASYNC_TASK_NAME", className);
		if(Ella.applicationContext != null){
			Ella.applicationContext.sendBroadcast(sendIntent);
		}else{
			Log.e(TAG, "No Context found");
		}	
	}

	@Override
	public void stopAsyncTask(String className) {
		Intent sendIntent = new Intent();
		sendIntent.setAction("edu.iscas.appcheckclient.broadcastreceiver.SEND_ASYNC_TASK_STOP");
		sendIntent.putExtra("ASYNC_TASK_NAME", className);
		if(Ella.applicationContext != null){
			Ella.applicationContext.sendBroadcast(sendIntent);
		}else{
			Log.e(TAG, "No Context found");
		}	
	}

}
